package com.s3.s3demo.aws;

import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.ListBucketsResponse;

/**
 * 获取存储桶列表
 */
public class GetBuckets extends AwsAuth {

    public static void main(String[] args) {
        try (S3Client s3Client = generateS3Client()) {
            ListBucketsResponse bucketsResponse = s3Client.listBuckets();
            bucketsResponse.buckets().forEach(bucket -> System.out.println(bucket.toString()));
        }
    }

}
